<?

//Data loading

$DEFINE_FONT=0;
$Result = ReadData ();
$pdf=new PDFReport("P","mm","Letter");
$pdf->AddPage();
$pdf->Content();
$pdf->Output();


function ReadData () {
		global $DBConnection;
		$SQL = "SELECT *, date_format(notify_date,'%D %M %Y') as not_date FROM ais_letter INNER JOIN tblletter ON ais_letter.letter_code=tblletter.code WHERE letter_id=".GetParam("letter_id","");
		///print $SQL;die();
		return $DBConnection->dbc->get_row($SQL);
}

class PDFReport extends PDF {

	function Header() {
		global $title,$perush,$page,$DEFINE_FONT,$Result;
		if ($DEFINE_FONT==0) {
			$this->AddFont('arialn','','arialn.php');
			$DEFINE_FONT=1;
		}
		$this->SetFont('arialn','',12);
		$this->Cell(180,5,$Result->place.", ".$Result->not_date,0,1,'L',0);
    	$this->Ln();
    	$this->Cell(180,5,"No.                  :".$Result->no,0,1,'L',0);
    	$this->Cell(180,5,"Lampiran        :".$Result->lampiran,0,1,'L',0);
    	$this->Cell(180,5,"Hal                  : ".$Result->perihal,0,1,'L',0);
    	$this->Ln();
    	$this->Ln();
	    //Header
	    //Column widths
	}

	function Content() {		
		//print $SQL;die();
		global $Result ;
    	$this->Cell(180,5,$Result->name,0,1,'L',0);
    	$this->Ln();
    	$this->Ln();    	
    	$this->Cell(180,5,"Kepada Yth.",0,1,'L',0);    	
    	$this->Cell(180,5,$Result->to_attention,0,1,'L',0);
    	$this->Cell(180,5,$Result->to_company,0,1,'L',0);
    	$this->Cell(180,5,$Result->place,0,1,'L',0);
    	$this->Ln();
    	$this->Ln();    	
    	$this->MultiCell(180,5,$Result->template);
		
	}
	
	function Footer() {
	    //Closure line
	    //$this->Cell(180,0,'','T');
	}

}


?>